/*
* 前缀表达式转后缀表达式后，计算表达式的值
*/


#include <iostream>
#include "InfixToPostfix.h"

using namespace std;
using namespace fl;

int main (int arg, char* argv[])
{
	InfixToPostfix ip;
        std::map<std::string, float> m;
	//string x;
        //string x = "(sin x) / x";
        //string x = "x + y * z";
        string x = "(1 + 2) * 3";
	cout << "Infix expression is : " << x << endl;
/*
	if ( 2 == arg)
	{
		x = argv[1];
	}
	else
	{
		cout << "参数错误，退出。" << endl;
		return 0;
	}
	*/
        ip.loadMathOperators();
        string postfix = ip.transform(x);

	cout << "Postfix expression is : " << postfix << endl;
	cout << "The expression value is : " << ip.evaluate(postfix, &m) << endl;

	return 0;
}

